<template>
  <div>
    <el-card shadow="always" class="box-card">
      <div class="tableTitle"><span>申请信息</span></div>
      <div class="devTitle"><span>{{infoDetail.planName}}</span></div>
      <div>
        <div class="tableStyle">
          <div class="labelS">计划编号</div>
          <div class="contentS">{{infoDetail.planNum}}</div>
          <div class="labelS">状态</div>
          <div class="contentS"></div>
        </div>
        <div class="tableStyle">
          <div class="labelS">计划名称</div>
          <div class="contentS">{{infoDetail.planName}}</div>
          <div class="labelS">所属部门</div>
          <div class="contentS">{{infoDetail.deptName}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">保养周期</div>
          <div class="contentS">{{infoDetail.maintenanceCycle}}</div>
           <div class="labelS">任务有效时间</div>
          <div class="contentS">{{infoDetail.taskEffectiveTime}}</div>
        </div>
       <!-- <div class="tableStyle">
          <div class="labelS">提前生成方式</div>
          <div class="contentS">{{infoDetail.planName}}</div>
           <div class="labelS">下次保养时间计算</div>
          <div class="contentS">{{infoDetail.planName}}</div>
        </div> -->
        <div class="tableStyle">
          <div class="labelS">提前生成时间</div>
          <div class="contentS">{{infoDetail.generateTime}}</div>
           <div class="labelS">提前提醒时间</div>
          <div class="contentS">{{infoDetail.noticeTime}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">验收方式</div>
          <div class="contentS">{{infoDetail.acceptanceMethod}}</div>
          <div class="labelS">验收规则</div>
          <div class="contentS">{{infoDetail.acceptanceRules}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">备注</div>
          <div class="contentS">{{infoDetail.remark}}</div>
        </div>
      </div>
    </el-card>
    <el-card shadow="always" class="box-card">
      <div class="headerStyle"><span class="tableTitle">负责人</span></div>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column label="序号" type="index" width="50">
        </el-table-column>
        <el-table-column prop="name" label="名称"> </el-table-column>
        <el-table-column prop="account" label="账号"> </el-table-column>
        <el-table-column prop="depart" label="职责"> </el-table-column>
      </el-table>
    </el-card>
    <el-card shadow="always" class="box-card">
      <div class="headerStyle"><span class="tableTitle">设备列表</span></div>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="deviceNum" label="设备编号"> </el-table-column>
        <el-table-column prop="deviceName" label="设备名称"> </el-table-column>
        <el-table-column prop="brandName" label="品牌"> </el-table-column>
        <el-table-column prop="category" label="类别" >
        </el-table-column>
        <el-table-column prop="specification" label="规格型号"> </el-table-column>
        <el-table-column prop="location" label="位置" >
        </el-table-column>
        <el-table-column prop="remark" label="备注"> </el-table-column>
      </el-table>
      <div style="text-align:right;margin-top:20px;">
                <el-pagination
  background
  :pager-count="5"
  layout="total,prev, pager, next"
 small
 :page-size="pageSize"
 @current-change="handleCurrentChange"
 :current-page.sync="currentPage"
  :total="total">
</el-pagination>
            </div>
    </el-card>
  </div>
</template>
<script>
import {getObj,planDevice} from "@/api/ems/maintain/plan";
export default {
  data() {
    return {
      tableData: [],
      infoDetail:{},
       id:"",
      currentPage: 1,
      total:0,
      pageSize:5,
    };
  },
  mounted(){
    this.id = this.$route.query.id;
    this.getObjList();
    this.getDevAnuthPage();
  },
  methods:{
    getObjList(){
      getObj(this.id).then((res)=>{
        this.infoDetail = res.data.data;
      })
    },
    getDevAnuthPage(){
      planDevice({planId: this.id,size:this.pageSize,current:this.currentPage}).then((res)=>{
         this.tableData = res.data.data.records;
            this.total = res.data.data.total;
      })

    },
    handleCurrentChange(index){
        this.currentPage = index;
         this.getDevAnuthPage();
    },
  }
  }

</script>
<style lang="scss" scoped>
@import "@/styles/color.scss";
.headerStyle {
  margin-bottom: 20px;
}
.tableTitle {
  color: #333;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 20px;
}

.devTitle {
  color: #262626;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
}
.box-card {
  margin-bottom: 10px;
  .el-card__body {
    padding-top: 10px;
  }
  .labelS {
    //display: inline-block;
    flex: 0 0 150px;
    //height: 40px;
    // margin-right: 10px;
    text-align: left;
    color: #606266;
    padding: 10px;
    border: 1px solid rgba(236, 240, 244, 100);
    margin-bottom: -1px;
  }
  .contentS {
    border: 1px solid rgba(236, 240, 244, 100);
    // height: 40px;
    color: #606266;
    width: 100%;
    margin-left: -1px;
    margin-bottom: -1px;
    padding: 10px;
    // margin: 10px 0;
    // width: calc(100% - 120px);
    // display: inline-block;
  }
  .tableStyle {
    display: flex;
  }
  .number {
    font-weight: bold;
    margin-top: 5px;
    font-size: 16px;
  }
}
</style>
